package com.shujia.flink.sink;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.sink.PrintSinkFunction;

public class Demo1Print {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        DataStreamSource<String> lines = env.socketTextStream("master", 8888);

        //print sink底层实现类
        PrintSinkFunction<String> printFunction = new PrintSinkFunction<>();

        //使用sink
        lines.addSink(printFunction);

        env.execute();
    }
}
